import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

export function getToken() {
  const token = localStorage.getItem('token')
  if (token) {
    return token
  } else {
    return false
  }
}

export function getRole() {
  const role = localStorage.getItem('roles')
  if (role) {
    return role
  } else {
    return false
  }
}

export function setToken(token) {
  localStorage.setItem('token', token)
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
